package com.katze.common.data.converters;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

public interface Converter<T> {

    default boolean support(Class<?> cs) {
        Type type = getClass().getGenericSuperclass();
        if (type instanceof ParameterizedType) {
            Class<?> c = (Class<?>) ((ParameterizedType) type).getActualTypeArguments()[0];
            return cs == c;
        }
        throw new NullPointerException("No data type specified");
    }

    T format(Object o);
}
